//////////////////////////////////////////////////////////////////////////////////
//	File	:	Particle.cpp
//	Author	:	Yuri Oyoko
//	Purpose	:	Particle contains the Partcle class which defines 
//				the particle object used in the game. The particle 
//				is created and managed by the base particle system.
//////////////////////////////////////////////////////////////////////////////////

#include "Particle.h"

Particle::Particle()
{
	SetIsActive(true);
	SecondsTicker = 0;
	TimeSinceStart = 0;
	Lifetime = 0;
	
}
Particle::~Particle()
{
}

void Particle::Update(float ElapsedTime)
{
	Velocity += Acceleration * ElapsedTime;
	Position += Velocity* ElapsedTime;
	Rotation += RotationSpeed * ElapsedTime;
	
	SecondsTicker += ElapsedTime;
	if(SecondsTicker >= 1.0)
	{
		TimeSinceStart += 1;
		SecondsTicker = 0;
		
	}
	if(TimeSinceStart > Lifetime)
	{
		SetIsActive(false);
	}
	
}
void Particle::Render()
{
}
RECT Particle::GetCollisionRect()
{
	RECT collisionRect = {0,0,0,0};
	return collisionRect;
}
bool Particle::CheckCollision()
{
	return false;
}

void Particle::Initialize(D3DXVECTOR2 thePosition, D3DXVECTOR2 theVelocity, D3DXVECTOR2 theAcceleration, float theLifetime, float theScale, float theRotation, float theRotationSpeed)
{
	Position = thePosition;
	Velocity = theVelocity;
	Acceleration = theAcceleration;
	Lifetime = theLifetime;
	Scale = theScale;
	RotationSpeed = theRotationSpeed;
	Rotation = theRotation;
}
